#ifndef __INPUT_H__
#define __INPUT_H__

#include <pcap.h>
#include <string>
#include <iostream>
#include "packet.hpp"

class InputPort
{
private:
  pcap_t * pd;
  std::string errmsg;

  void setErrMsg (std::string e) { this->errmsg += e; }

public:
  enum LinkType
  {
    LT_NULL = 0,
    LT_ETHERNET,
    LT_RAWIP,
  } ;

  InputPort ();
  ~InputPort ();

  bool openFile (std::string fileName);
  bool openInterface (std::string devName);
  bool portReady ();

  bool setFilter (std::string filter);
  bool getPacket (Packet * pkt);
  LinkType getLinkType ();

  std::string & getErrMsg () { return this->errmsg; }
};

#endif /* __INPUT_H__ */
